package com.example.demo.modules.controller;

import com.example.demo.common.utils.R;
import com.example.demo.modules.entity.StudentEntity;
import com.example.demo.modules.service.StudentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description:
 * @Author Landiy
 * @Emali yuyi@mingze.com
 * @Date 2021/6/1715:08
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    @Resource
    private StudentService studentService;

    @GetMapping("/list")
    public R listStudent() {
        return R.ok().put("data", studentService.listStudent());
    }

    @PostMapping("/create")
    public R insertStudent(@RequestBody StudentEntity studentEntity) {
        Boolean i = studentService.save(studentEntity);
        return R.ok().put("status",i);
    }
}
